import { Tree } from 'antd';
import React from 'react';
import {adminRoutes} from '../../../router'

const MenuTree = (props) => {
  const onSelect = (selectedKeys, info) => {
    console.log('selected', selectedKeys, info);
  };

  const onCheck = (checkedKeys, info) => {
    console.log('onCheck', checkedKeys, info);
    props.onChange(info.checkedNodes) //将数据包传给表单
  };

  return (
    <Tree
      checkable
      onSelect={onSelect}
      onCheck={onCheck}
      fieldNames={{title:'label'}}
      treeData={adminRoutes}
    />
  );
};

export default MenuTree;